home *** CD-ROM | disk | FTP | other *** search
Wrap
head 1.2; branch ; access ; symbols ; locks ; comment @ * @; 1.2 date 92.04.27.20.33.13; author death; state Exp; branches ; next 1.1; 1.1 date 92.02.09.18.41.40; author death; state Exp; branches ; next ; desc @This file contains various general data types that various applications are apt to use. This includes such things as bits16, to be sure you're getting a 16 bit quantity. @ 1.2 log @miscelaneous changes @ text @/* ==================================================================== This file declares several data types that varoious applications may wish to use. This is $Revision: 1.1 $ of this file It was last modified by $Author: death $ on $Date: 92/02/09 18:41:40 $ Note that this file was created while using the New Century Schoolbook Roman typeface. You may find that some things line up strangely if you don't use that family. $Log: generalTypes.h,v $ * Revision 1.1 92/02/09 18:41:40 death * Initial revision * ==================================================================== */ #import <objc/objc.h> // // Draft 1 of standard types. I can see this is a small step towards making everything an // object. But, we'll see how we like what we have. I'm a bit bothered by Cstring, for now, // but... // // Integer should be the largest available signed intergral number on the system. // It is capitalized and fully spelled to help distnguish from normal int's in C. // Naturally, PositiveInteger is it's unsigned counterpart. Note that PositiveInteger, // despite it's name, does include 0! =) // typedef long int Integer; typedef unsigned long int PositiveInteger; // // Character is used to represent a letter, digit, or symbol on the local system. It makes no // pretenses at being able to deal with an ideographic, or potentially even a sylabic writing // system. In general, it should not be used as a number // typedef unsigned char Character; // // Cstring is a special case, since one just ends up using pointers to chars frequently. // typedef char* CString; // // id is all well and good, but let's be a bit more general and readable. So, we define // Object to be a reference to an object // NOTE: Seems I can't call it Object bcause there is already a class called Object (oops). // Naming it thus Objekt, which will allow easier search and replaces later when I think // of a better name (in many cases, Object is implicit, so it need not be stated). In any // case, it brings to my attention that if I had to redefine any of these, the search and // replace process would be messy... // typedef id Objekt; // // Pointer is a reference to an untyped pointer. // typedef void* Pointer; // // Boolean is, of course, a type for storing true or false values. no others (undefined, etc) // typedef BOOL Boolean; // // GenericType is used to store any of the preceeding types. // typedef union { Integer integer; PositiveInteger positiveinteger; Character character; CString cstring; Objekt object; Pointer pointer; Boolean boolean; } GenericType; // // DataType is used to store any of the primary data types here, like GenericType, but // also to record which type is stored, and thus allow for some type checking by the // programmer. // typedef struct { GenericType data; Integer type; } DataType; // // Now, define some values that correspond to thse types... // // (Ahh, for C++'s ability to define constants...) // #define CARRIGERETURN 0x13 #define LINEFEED 0x10 #define NEWLINE 0x10 #define TAB 0x09 //#define NULL 0x00 /* already defined, I believe */ #define ESCAPE 0x1B // // Cstring definitions // #define NullCString (CString) 0x00 #define CStringEnd (char) 0x00 // // Object definitions // (nil is defined as part of Objective c. note that casing! Nil is a nil Class structure). // #define NullObject nil // // Pointer definitions // #define NullPointer 0x00 // // Boolean definitions. // //#define YES /* Defined by Objective C. uncomment if this changes or this moves*/ //#define NO /* Defined by Objective C. uncomment if this changes or this moves*/ #define True YES #define False NO // // Define constants for use in the DataType struct // #define TYPE_NONE 0 #define TYPE_INTEGER 1 #define TYPE_POSITIVEINTEGER 2 #define TYPE_CHARACTER 3 #define TYPE_CSTRING 4 #define TYPE_OBJECT 5 #define TYPE_POINTER 6 #define TYPE_BOOLEAN 7 // // Define some types. // These can all be considered as special cases of PositiveInteger, below. // typedef unsigned char Byte; typedef unsigned char bits8; typedef unsigned short int bits16; typedef unsigned int bits32; typedef Byte* ByteString; typedef Integer ErrorCode; @ 1.1 log @Initial revision @ text @d4 2 a5 2 This is $Revision$ of this file It was last modified by $Author$ on $Date$ d7 4 a10 1 $Log$ d14 2 d17 3 a19 1 // Define a type to be used so one needn't always type char* d21 103 a123 1 typedef char* Cstring; a124 1 d126 2 a127 1 // Define some binary types d129 1 d133 2 a134 1 @